<template>
	<view class="page">
		<u-parse v-if="type != 'community'" :content="content" />
	</view>
</template>

<script>
	import {
		getxy
	} from "@/request/myApi.js";
	export default {
		data() {
			return {
				type: "", // 服务条款 order 社群 community 关于我们 platform
				content: "", // 内容
			};
		},
		onLoad(e) {
			this.type = e.type;
			if (e.type == "order") {
				this.getData();
			} else if (e.type == "platform") {
				this.getData();
			} else if (e.type == "community") {
				uni.setNavigationBarTitle({
					title: "社群",
				});
			}
		},
		methods: {
			// 获取协议
			getData() {
				getxy().then((res) => {
					if (res.code == 200) {
						// let info = res.data.find((i) => i.type == this.type);
						// if (info) {
						//   this.content = info.content;
						//   uni.setNavigationBarTitle({
						//     title: info.title,
						//   });
						// }
					}
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	.page {
		word-break: break-all;
		padding: 20rpx;

		.empty {
			display: flex;
			flex-direction: column;
			align-items: center;
			text-align: center;
			color: #bababa;
			font-weight: 400;
			font-size: 32rpx;
			line-height: 44rpx;
		}
	}
</style>